function _isValidType(e,t){return Array.isArray(t)?Array.isArray(e):null!=e&&typeof e==typeof t}!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,(function(e,t){function n(e){var t=e.length,n=Z.type(e);return"function"!==n&&!Z.isWindow(e)&&(!(1!==e.nodeType||!t)||("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e))}function r(e,t,n){if(Z.isFunction(t))return Z.grep(e,(function(e,r){return!!t.call(e,r,e)!==n}));if(t.nodeType)return Z.grep(e,(function(e){return e===t!==n}));if("string"==typeof t){if(ue.test(t))return Z.filter(t,e,n);t=Z.filter(t,e)}return Z.grep(e,(function(e){return V.call(t,e)>=0!==n}))}function o(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function i(e){var t=ve[e]={};return Z.each(e.match(he)||[],(function(e,n){t[n]=!0})),t}function a(){G.removeEventListener("DOMContentLoaded",a,!1),e.removeEventListener("load",a,!1),Z.ready()}function u(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=Z.expando+Math.random()}function s(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(we,"-$1").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:be.test(n)?Z.parseJSON(n):n)}catch(e){}me.set(e,t,n)}else n=void 0;return n}function c(){return!0}function l(){return!1}function f(){try{return G.activeElement}catch(e){}}function p(e,t){return Z.nodeName(e,"table")&&Z.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function d(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function h(e){var t=He.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function v(e,t){for(var n=0,r=e.length;r>n;n++)ye.set(e[n],"globalEval",!t||ye.get(t[n],"globalEval"))}function g(e,t){var n,r,o,i,a,u,s,c;if(1===t.nodeType){if(ye.hasData(e)&&(i=ye.access(e),a=ye.set(t,i),c=i.events))for(o in delete a.handle,a.events={},c)for(n=0,r=c[o].length;r>n;n++)Z.event.add(t,o,c[o][n]);me.hasData(e)&&(u=me.access(e),s=Z.extend({},u),me.set(t,s))}}function y(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&Z.nodeName(e,t)?Z.merge([e],n):n}function m(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ce.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function b(t,n){var r,o=Z(n.createElement(t)).appendTo(n.body),i=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(o[0]))?r.display:Z.css(o[0],"display");return o.detach(),i}function w(e){var t=G,n=Me[e];return n||("none"!==(n=b(e,t))&&n||((t=(Fe=(Fe||Z("";$.showModalContent(i,t,n,r,o),$(".close-button").one("click",(function(e){e.stopPropagation(),$.hideMessage()}))};var i=0;CP.showPopupOverlay=function(){++i>0&&o.show()},CP.hidePopupOverlay=function(){0===(i=Math.max(0,i-1))&&o.hide()},Keytrap.bind("esc",(function(){Hub.pub(HUB_EVENTS.KEY_PRESS,{key:"esc"})}),!0)}(),"object"!=typeof window.CP&&(window.CP={}),document.documentElement.className+=" js",function(){function e(){u.on("click",t)}function t(e){var t=$(e.target),r=t.closest(".is-dropdown");if(!(0===t.closest(".new-pen-from-template-label").length&&r.length>0)){var i=t.closest("[data-dropdown]");i.length>0?n(e,i):o()}}function n(e,t){e.preventDefault();var n=t.data("dropdown"),o=$(n);o.hasClass("open")?(t.attr("aria-expanded",!1),o.removeClass("open")):(t.attr("aria-expanded",!0),r(o,t),o.addClass("open")),$(".is-dropdown").not(o[0]).removeClass("open")}function r(e,t){if("css"!==e.data("dropdown-position")){var n,r=t.offset(),o="right"===e.data("dropdown-position"),i=o?"right":"left";n=o?document.body.offsetWidth-r.left-t.outerWidth():r.left-e.outerWidth()/2+25,n=Math.max(10,n);var a={};a[i]=n,e.css(a)}}function o(){$(".is-dropdown").removeClass("open"),$("[data-dropdown][aria-expanded]").attr("aria-expanded",!1)}function i(){Hub.sub(HUB_EVENTS.KEY_PRESS,a),Hub.sub(HUB_EVENTS.POPUP_OPEN,o),Hub.sub(HUB_EVENTS.POPUP_CLOSE,o)}function a(e,t){"esc"===t.key&&o()}CP.Dropdowns={};var u=$("body");CP.Dropdowns.init=function(){e(),i()},CP.Dropdowns.init()}(),window.HandleIFrameClicks={init:function(e){this.pen=e,this._bindToDOM()},_bindToDOM:function(){window.addEventListener("message",$.proxy(this.handleIFrameClickEvent,this))},handleIFrameClickEvent:function(e){if(this._allowedToOpenWindows()){var t=this._cleanURL(this._getURLFromEvent(e));t.match(/^https?:\/\/\S+$/)&&window.open(t)}},_allowedToOpenWindows:function(){return this.pen.user_id>1},_getURLFromEvent:function(e){return"string"==typeof e.data?e.data:""},_cleanURL:function(e){var t=this._getIFrameURLRemoved(e);return t=(t=(t=(t=this._sanitizeURL(t)).replace(/(java|vb)?script/gim,"")).replace(/eval/gim,"")).split("?")[0]},_getIFrameURLRemoved:function(e){return e.replace(/http(s)?:\/\/(s\.)?codepen\.(dev|io)\/(boomerang\/\S+|\S+\/fullpage)\/\w+(\.html)?/m,"")},_sanitizeURL:function(e){return e.replace(/[^\w!#%&()+,./:;=?@|~-]/,"")}},window.ViewSwitcher={TYPES:["top","left","right"],init:function(){this.$body=$("body"),this._bindToDOM(),this._bindToHub(),this.saveLayoutToSession(window.__layoutType)},_bindToDOM:function(){this.$body.on("click","[data-layout-type]",this.onLayoutTypeButtonClick)},onLayoutTypeButtonClick:function(e){e.preventDefault();var t=$(e.currentTarget).attr("data-layout-type");window.ViewSwitcher.changeLayout(t)},_bindToHub:function(){Hub.sub(HUB_EVENTS.PEN_EDITOR_UI_CHANGE_SERVER,$.proxy(this._onServerUIChange,this))},_onServerUIChange:function(e,t){t.ui&&t.ui.layout&&this.changeUILayout(t.ui.layout)},changeLayout:function(e){this.changeUILayout(e),this.saveLayoutToSession(e)},saveLayoutToSession:function(e){$.cookie&&$.cookie("__editor_layout",e,{expires:30,path:"/",samesite:"Lax"})},changeUILayout:function(e){this.validateLayoutType(e),this.$body.removeClass("layout-"+CP.ui.layout);var t="left"===e||"right"===e;this.$body[t?"addClass":"removeClass"]("layout-side"),this.$body.addClass("layout-"+e),CP.ui.layout=e,Hub.pub(HUB_EVENTS.PEN_EDITOR_UI_CHANGE,{ui:{layout:e}}),Hub.pub(HUB_EVENTS.PEN_EDITOR_REFRESH_REQUEST,{delay:0})},validateLayoutType:function(e){if(!this.TYPES.includes(e))throw"Invalid layout type: "+e}},window.ViewSwitcher.init(),function(){function e(e,r){$.hideModal(),t(e),n(r),FullPageRenderer.fork()}function t(e){$("meta[name='csrf-token']").attr("content",e)}function n(e){window.__user=e}function r(e){return!!e.origin.match(window.__CPDATA.host)&&"logged-into-codepen"===e.data.type}function o(){$.showModal(_fullURL("/accounts/anon/"),"modal-signup")}window.addEventListener("message",(function(t){r(t)&&e(t.data.csrf,t.data.user)})),window.CP.fullLoginHandler={showAnonymousUserSignupModal:o}}(),window.FullPageRenderer={init:function(){_.extend(this,AJAXUtil),"pen"===window.__item.itemType?(this.pen=window.__item,this.item=this.pen):"project"===window.__item.itemType&&(this.project=window.__item,this.item=this.project),this._bindToDOM()},fork:function(){this._onFork()},_bindToDOM:function(){$("body").on("click","#fork",$.proxy(this._onFork,this))},_onFork:function(){if(!window.__user.anon)return this.pen?this.post("/penfork",this._getPenForkParams(),this._onDoneFork):this.project?this.post("/projects/fork",this._getProjectForkParams(),this._onDoneFork):void 0;window.CP.fullLoginHandler.showAnonymousUserSignupModal()},_getPenForkParams:function(){return{slug_hash:this.pen.private?this.pen.slug_hash_private:this.pen.slug_hash}},_getProjectForkParams:function(){return{_isJSON:!0,json:{source:this.project.slug_hash}}},_onDoneFork:function(e){this.pen&&(document.location=e.url),this.project&&(document.location=e.payload.project.url)}},HandleIFrameClicks.init(__item),window.FullPageRenderer.init();